<!-- 这里是一次性加载 LayoutComponents -->
<template>
  <component :is="LayoutComponents[layout]" />
</template>

<script setup lang="ts" name="layout">
import { computed, type Component } from 'vue'
import { LayoutType } from '@/stores/interface'
import { useGlobalStore } from '@/stores/modules/global'
import LayoutDefault from './LayoutDefault/index.vue'
import LayoutClassic from './LayoutClassic/index.vue'

const LayoutComponents: Record<LayoutType, Component> = {
  default: LayoutDefault,
  classic: LayoutClassic
}

const globalStore = useGlobalStore()
const layout = computed(() => globalStore.layout)
</script>

<style scoped lang="scss">
.layout {
  min-width: 600px;
}
</style>
